package tech.aistar.mapper.like;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.like.NotePraise;

/**
 * Created by lenovo on 2019/10/17.
 */
public interface PraiseMapper {
    /**
     * 根据游记id获取点赞数
     * @param noteId
     * @return
     */
    @Select("select * from notepraise where note_id = #{value}")
    NotePraise getPraiseNumById(Integer noteId);

    /**
     * 插入点赞
     * @param id
     */
    @Insert("insert into notepraise(note_id) values(#{value})")
    void insertPraiseById(Integer id);

    /**
     * 更新点赞信息
     * @param num
     * @param noteId
     */
    @Update("update notepraise set num=#{num} where note_id=#{id}")
    void updatePraise(@Param("num") Integer num, @Param("id") Integer noteId);

    @Update("update notes set support=#{num} where note_id=#{id}")
    void updataNotesSuppById(@Param("num") Integer num, @Param("id") Integer noteId);

}
